﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using QzEbook.AccessObject;
using System.Text;
using System.Collections.Generic;

public partial class admin_manager_TagList : System.Web.UI.UserControl
{
    private StringBuilder sb;
    protected void Page_Load(object sender, EventArgs e)
    {
        bindData();
    }

    private void bindData()
    {
        sb = new StringBuilder();
        Tag tag = new Tag();
        List<Tag> list = tag.selectList();
        int i = 0;


        sb.AppendLine("<table id=\"tagList\">");
        foreach (Tag item in list)
        {

            if (i == 0)
            {
                sb.AppendLine("<tr>");
            }
            sb.AppendFormat("<td>{0}</td>", Tag.getLinkHtml(item.Id, item.Count));
            i = ++i % 4;
            if (i == 0)
            {
                sb.AppendLine("</tr>");
            }
        }

        sb.AppendLine("</table>");
    }

    protected override void Render(HtmlTextWriter writer)
    {
        if (sb != null)
        {
            writer.Write(sb.ToString());
        }
        base.Render(writer);
    }
}
